//
//  AppDelegate.m
//  NewsReader
//
//  Created by Rain on 16/7/18.
//  Copyright © 2016年 Rain. All rights reserved.
//

#import "AppDelegate.h"
#import "LoginPage.h"
#import "AdvertPage.h"

@implementation AppDelegate

+ (AppDelegate *)appDeg
{
    return  (AppDelegate *)[UIApplication sharedApplication].delegate;
}

-(void)showHomePage
{
    LoginPage *page = [[LoginPage alloc] init];
    
    //加入顶部导航栏
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:page];
    
    self.window.rootViewController = navigationController;
    
    [self.window makeKeyAndVisible];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //透明顶部状态栏，在targe－－info－－custom ios target properities中添加：View controller-based status bar appearance和：Status bar is initially hidden
    [application setStatusBarStyle:UIStatusBarStyleLightContent];
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

    //显示广告页面
    [AdvertPage showAdvertPage];
    
    [self.window makeKeyAndVisible];
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    if ([AdvertPage canShowAdvertPage]) {
        [AdvertPage showAdvertPage];
    }
   
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
}

- (void)applicationWillTerminate:(UIApplication *)application
{
}

@end
